table of contents
scanimage(1) | SANE Scanner Access Now Easy | scanimage(1) |
NAME¶
scanimage - scan an image
SYNOPSIS¶
scanimage [-d|--device-name dev] [--format format] [-i|--icc-profile profile] [-L|--list-devices] [-f|--formatted-device-list format] [-b|--batch [=format]] [--batch-start start] [--batch-count count] [--batch-increment increment] [--batch-double] [--accept-md5-only] [-p|--progress] [-o|--output-file] [-n|--dont-scan] [-T|--test] [-A|--all-options] [-h|--help] [-v|--verbose] [-B|--buffer-size [=size]] [-V|--version] [device-specific-options]
DESCRIPTION¶
scanimage is a command-line interface to control image acquisition devices such as flatbed scanners or cameras. The device is controlled via command-line options. After command-line processing, scanimage normally proceeds to acquire an image. The image data is written to standard output in one of the PNM (portable aNyMaP) formats (PBM for black-and-white images, PGM for grayscale images, and PPM for color images), TIFF format (black-and-white, grayscale or color), PNG format, or JPEG format (compression level 75). scanimage accesses image acquisition devices through the SANE (Scanner Access Now Easy) interface and can thus support any device for which there exists a SANE backend (try apropos sane- to get a list of available backends).
EXAMPLES¶
To get a list of devices:
scanimage -L
To scan with default settings to the file image.pnm:
scanimage >image.pnm
To scan 100x100 mm to the file image.tiff (-x and -y may not be available with all devices):
scanimage -x 100 -y 100 --format=tiff >image.tiff
To print all available options:
scanimage -h
OPTIONS¶
Parameters are separated by a blank from single-character options (e.g. -d epson) and by a "=" from multi-character options (e.g. --device-name=epson).
The -d or --device-name options must be followed by a SANE device-name like `epson:/dev/sg0' or `hp:/dev/usbscanner0'. A (partial) list of available devices can be obtained with the --list-devices option (see below). If no device-name is specified explicitly, scanimage reads a device-name from the environment variable SANE_DEFAULT_DEVICE. If this variable is not set, scanimage will attempt to open the first available device.
The --format format option selects how image data is written to standard output or the file specified by the --output-file option. format can be pnm, tiff, png, or jpeg. If --format is not specified, PNM is written by default.
The -i or --icc-profile option is used to include an ICC profile into a TIFF file.
The -L or --list-devices option requests a (partial) list of devices that are available. The list is not complete since some devices may be available, but are not listed in any of the configuration files (which are typically stored in directory /etc/sane.d). This is particularly the case when accessing scanners through the network. If a device is not listed in a configuration file, the only way to access it is by its full device name. You may need to consult your system administrator to find out the names of such devices.
The -f or --formatted-device-list option works similar to --list-devices, but requires a format string. scanimage replaces the placeholders %d %v %m %t %i %n with the device name, vendor name, model name, scanner type, an index number and newline respectively. The command
will produce something like:
The --batch* options provide the features for scanning documents using document feeders. --batch [format] is used to specify the format of the filename that each page will be written to. Each page is written out to a single file. If format is not specified, the default of out%d.pnm (or out%d.tif for --format tiff, out%d.png for --format png or out%d.jpg for --format jpeg) will be used. This option is incompatible with the --output-path option. format is given as a printf style string with one integer parameter. --batch-start start selects the page number to start naming files with. If this option is not given, the counter will start at 1. --batch-count count specifies the number of pages to attempt to scan. If not given, scanimage will continue scanning until the scanner returns a state other than OK. Not all scanners with document feeders signal when the ADF is empty, use this command to work around them. With --batch-increment increment you can change the amount that the number in the filename is incremented by. Generally this is used when you are scanning double-sided documents on a single-sided document feeder. A specific command is provided to aid this: --batch-double will automatically set the increment to 2. --batch-prompt will ask for pressing RETURN before scanning a page. This can be used for scanning multiple pages without an automatic document feeder.
The --accept-md5-only option only accepts user authorization requests that support MD5 security. The SANE network daemon (saned) is capable of doing such requests. See saned(8).
The -p or --progress option requests that scanimage prints a progress counter. It shows how much image data of the current image has already been received by scanimage (in percent).
The -o or --output-file option requests that scanimage saves the scanning output to the given path. This option is incompatible with the --batch option. The program will try to guess --format from the file name. If that is not possible, it will print an error message and exit.
The -n or --dont-scan option requests that scanimage only sets the options provided by the user but doesn't actually perform a scan. This option can be used to e.g. turn off the scanner's lamp (if supported by the backend).
The -T or --test option requests that scanimage performs a few simple sanity tests to make sure the backend works as defined by the SANE API (in particular the sane_read() function is exercised by this test).
The -A or --all-options option requests that scanimage lists all available options exposed the backend, including button options. The information is printed on standard output and no scan will be done.
The -h or --help options request help information. The information is printed on standard output and in this case, no attempt will be made to acquire an image.
The -v or --verbose options increase the verbosity of the operation of scanimage. The option may be specified repeatedly, each time increasing the verbosity level.
The -B option without argument changes the input buffer size from the default 32KB to 1MB. For finer grained control, use --buffer-size= followed by the number of KB.
The -V or --version option requests that scanimage prints the program and package name, the version number of the SANE distribution that it came with and the version of the backend that it loads. Usually that's the dll backend. If more information about the version numbers of the backends are necessary, the DEBUG variable for the dll backend can be used. Example: SANE_DEBUG_DLL=3 scanimage -L .
As you might imagine, much of the power of scanimage comes from the fact that it can control any SANE backend. Thus, the exact set of command-line options depends on the capabilities of the selected device. To see the options for a device named dev, invoke scanimage via a command-line of the form:
The documentation for the device-specific options printed by --help is best explained with a few examples:
-l 0..218mm [0]
Top-left x position of scan area.
--brightness -100..100% [0]
Controls the brightness of the acquired image.
--default-enhancements
Set default values for enhancement controls.
--mode Lineart|Gray|Color [Gray]
Selects the scan mode (e.g., lineart or color).
--custom-gamma[=(yes|no)] [inactive]
Determines whether a builtin or a custom gamma-table should be used.
Note that the --help option is processed only after all other options have been processed. This makes it possible to see the option settings for a particular mode by specifying the appropriate mode-options along with the --help option. For example, the command-line:
scanimage --help --mode color
would print the option settings that are in effect when the color-mode is selected.
--gamma-table 0..255,...
Gamma-correction table. In color mode this option
equally affects the red, green, and blue channels
simultaneously (i.e., it is an intensity gamma table).
--filename <string> [/tmp/input.ppm]
The filename of the image to be loaded.
ENVIRONMENT¶
- SANE_DEFAULT_DEVICE
- The default device-name.
FILES¶
- /etc/sane.d
- This directory holds various configuration files. For details, please refer to the manual pages listed below.
- ~/.sane/pass
- This file contains lines of the form
scanimage uses this information to answer user authorization requests automatically. The file must have 0600 permissions or stricter. You should use this file in conjunction with the --accept-md5-only option to avoid server-side attacks. The resource may contain any character but is limited to 127 characters.
SEE ALSO¶
sane(7), gamma4scanimage(1), xscanimage(1), xcam(1), xsane(1), scanadf(1), sane-dll(5), sane-net(5), sane-"backendname"(5)
AUTHOR¶
David Mosberger, Andreas Beck, Gordon Matzigkeit, Caskey Dickson, and many others. For questions and comments contact the sane-devel mailinglist (see http://www.sane-project.org/mailing-lists.html).
BUGS¶
For vector options, the help output currently has no indication as to how many elements a vector-value should have.
10 Jul 2008 |